package com.treasure.mall.zbqmallapi.controller.wxtemplate;

import com.treasure.mall.biz.dto.wxtemplate.SubscribeSaveDTO;
import com.treasure.mall.biz.entity.user.UserPO;
import com.treasure.mall.biz.service.core.wxtemplate.SubscribeUserService;
import com.treasure.mall.zbq.common.annotation.CurrentUser;
import com.treasure.mall.zbq.common.base.ApiResult;
import com.treasure.mall.zbqmallapi.annotation.AccessControl;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 * <p>
 * +---------------------------------------------------------
 * * @package: com.treasure.mall.zbqmallapi.controller.wxtemplate
 * * @author: guomw (guomwchen@foxmail.com)
 * * @date: 2020/8/4 10:07 上午
 * * @since: V1.0.0
 * +---------------------------------------------------------
 * 注意：本内容仅限于内部传阅，禁止外泄以及用于其他的商业目的
 *
 */
@Api(tags = "订阅模块")
@RestController
@RequestMapping("/subscribe")
public class SubscribeController {

    @Autowired
    private SubscribeUserService subscribeUserService;


    /**
     * 上报订阅信息
     *
     * @param user
     * @param dto
     * @return
     */
    @PostMapping("/pushSubscribe")
    @AccessControl(needLogin = true)
    public ApiResult pushSubscribe(@CurrentUser UserPO user, SubscribeSaveDTO dto) {
        subscribeUserService.pushSubscribe(dto, user);
        return ApiResult.ok();
    }

}
